package com.sky.mapper.admin;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper extends BaseMapper<SetmealDish> {
    // 根据菜品id查询套餐id
    List<Long> getSetmealIdsByDishIds(List<Long> ids);

    // 根据套餐id查询菜品id
    List<Long> getDishIdsBySetmealId(long setmealId);

    // 批量插入 套餐-菜品 数据
    void insertBatch(List<SetmealDish> setmealDishes);

    // 根据套餐id删除
    @Delete("delete from sky_take_out.setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    // 获取套餐中的菜品信息
    @Select("select * from sky_take_out.setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(long setmealId);

    // 根据套餐id删除 套餐--菜品 数据
    void deleteBatch(List<Long> setmealIds);
}